/**
 * 手机号登录
 * 
 */
function mobileLogin(params, callback) {
  httpPost("/api/auth/jwt/user/mobile/token", params, callback)
}

/**
 * 获取验证码
 * 
 */
function getSingCode(params, callback) {
  httpGet("/api/auth/jwt/app/login/mobileCode", params, callback)
}

function passwordLogin(params, callback) {
  httpPost("/api/auth/jwt/user/pwd/token", params, callback)
}

/**
 * 获取头像昵称
 * 
 */
function personalView(params, callback) {
  httpGet("/api/user/user/personal/view", params, callback)
}



/**
 * 获取账户类型
 * 
 */
function getAccountTypeByAuthMobile(params, callback) {
  httpGet("/api/merchant/user/merchant/getAccountTypeByAuthMobile", params, callback)
}
/**
 * 监管锁查询页面
 * 
 */
function deviceQueryPage(params, callback) {
  httpPost("/api/mdm/saas/device/queryPage", params, callback)
}



/**
 * 获取设备列表
 * 
 */
function queryPageMyDevice(params, callback) {
  httpPost("/api/mdm/saas/device/queryPageMyDevice", params, callback)
}

/**
 * 获取设备详细信息
 * 
 */
function getMyDeviceById(params, callback) {
  httpPost("/api/mdm/saas/device/getById", params, callback)
}

/**
 * 获取设备硬件信息
 * 
 */
function getMyDeviceInfoById(params, callback) {
  httpPost("/api/mdm/saas/deviceInfo/getByDeviceId", params, callback)
}
/**
 * 获取设备操作记录
 * 
 */
function getDeviceOperationLogList(params, callback) {
  httpPost("/api/mdm/saas/deviceOperationLog/getDeviceOperationLogList", params, callback)
}

/**
 * 添加设备
 * 
 */
function storeAddDeviceByWaitAssign(params, callback) {
  httpPost("/api/mdm/saas/device/storeAddDeviceByWaitAssign", params, callback)
}



/**
 * 获取我的MDM门店列表
 * 
 */
function queryMyMdmMerchantStoreList(params, callback) {
  httpPost("/api/merchant/saas/merchantStore/queryMyMdmMerchantStoreList", params, callback)
}
/**
 * 获取可分配的门店列表
 * 
 */
function queryMdmMerchantStoreList(params, callback) {
  httpPost("/api/merchant/saas/merchantStore/queryMdmMerchantStoreList", params, callback)
}


/**
 * 获取我的MDM员工列表
 * 
 */
function queryEnterpriseMerchantUserByAssignList(params, callback) {
  httpPost("/api/merchant/saas/merchantUser/queryEnterpriseMerchantUserByAssignList", params, callback)
}


/**
 * 解除激活锁
 * 
 */
function closeActivationLock(params, callback) {
  httpPost("/api/mdm/saas/device/closeActivationLock", params, callback)
}

/**
 * 开启激活锁
 * 
 */
function enabledActivationLock(params, callback) {
  httpPost("/api/mdm/saas/device/enabledActivationLock", params, callback)
}




/**
 * 设备编辑
 * 
 */
function deviceEdit(params, callback) {
  httpPost("/api/mdm/saas/device/edit", params, callback)
}
/**
 * 设备丢失模式
 * 
 */
function deviceSetLose(params, callback) {
  httpPost("/api/mdm/saas/device/setLose", params, callback)
}

/**
 * 设备上锁
 * 
 */
function deviceUpLock(params, callback) {
  httpPost("/api/mdm/saas/device/deviceUpLock", params, callback)
}
/**
 * 设备解锁
 * 
 */
function deviceUnLock(params, callback) {
  httpPost("/api/mdm/saas/device/deviceUnLock", params, callback)
}

/**
 * 设备恢复出厂设置
 * 
 */
function eraseDevice(params, callback) {
  httpPost("/api/mdm/saas/device/eraseDevice", params, callback)
}

/**
 * 清除屏幕密码
 * 
 */
function setClearPasscode(params, callback) {
  httpPost("/api/mdm/saas/device/setClearPasscode", params, callback)
}

/**
 * 设备分配门店
 * 
 */
function deviceAssignStore(params, callback) {
  httpPost("/api/mdm/saas/device/deviceAssignStore", params, callback)
}
/**
 * 设备分配员工
 * 
 */
function deviceAssignUid(params, callback) {
  httpPost("/api/mdm/saas/device/deviceAssignUid", params, callback)
}

/**
 * 金额支付
 * 
 */
function payBalance(params, callback) {
  httpPost("/api/check/saas/mdm/order/payBalance", params, callback)
}

/**
 * 同步设备
 * 
 */
function deviceSync(params, callback) {
  httpPost("/api/mdm/saas/device/deviceSync", params, callback)
}

/**
 * 恢复监管
 * 
 */
function renewRegulation(params, callback) {
  httpPost("/api/mdm/saas/device/renewRegulation", params, callback)
}


/**
 * 获取激活码
 * 
 */
function getEscrowKey(params, callback) {
  httpPost("/api/mdm/saas/device/getEscrowKey", params, callback)
}

/**
 * 收租模式配置
 * 
 */
function rentIdentifierQueryAll(params, callback) {
  httpPost("/api/mdm/saas/rentIdentifier/queryAll", params, callback)
}

/**
 * 收租模式配置下的app列表
 * 
 */
function queryAppListById(params, callback) {
  httpPost("/api/mdm/saas/rentIdentifier/queryAppListById", params, callback)
}
/**
 * 设置收租模式
 * 
 */
function deviceSetRent(params, callback) {
  httpPost("/api/mdm/saas/device/setRent", params, callback)
}

/**
 * 定位信息
 * 
 */
function deviceLocationRecord(params, callback) {
  httpPost("/api/mdm/saas/deviceLocationRecord/queryPage", params, callback)
}
/**
 * 获取设备配置
 * 
 */
function getDeviceConfig(params, callback) {
  httpPost("/api/mdm/saas/device/getDeviceConfig", params, callback)
}

/**
 * 重新下发配置
 * 
 */
function sendDefaultRestrict(params, callback) {
  httpPost("/api/mdm/saas/device/sendDefaultRestrict", params, callback)
}

/**
 * 定位信息刷新
 * 
 */
function deviceLocationSync(params, callback) {
  httpPost("/api/mdm/saas/deviceLocationNewest/deviceLocationSync", params, callback)
}

/**
 * 移除设备ABM解绑
 * 
 */
function disownDevice(params, callback) {
  httpPost("/api/mdm/saas/device/disownDevice", params, callback)
}



/**
 * 查询功能限制
 * 
 */
function queryAllFunctionRestrict(params, callback) {
  httpPost("/api/mdm/saas/functionRestrict/queryAll", params, callback)
}

/**
 * 设置功能限制
 * 
 */
function setFunctionRestrict(params, callback) {
  httpPost("/api/mdm/saas/device/setFunctionRestrict", params, callback)
}


/**
 * 查询解锁费用
 * 
 */
function getMerchantMdmPrice(params, callback) {
  httpPost("/api/merchant/saas/merchant/getMerchantMdmPrice", params, callback)
}



/**
 * 获取商户用户
 * 
 */
function getMerchantUser(params, callback) {
  httpPost("/api/merchant/user/merchantUser/getMerchantUser", params, callback)
}


/**
 * 获取商户信息
 * 
 */
function getMerchantInfo(params, callback) {
  httpPost("/api/merchant/saas/merchant/getMerchantInfo", params, callback)
}







/**
 * 
 * ################################# 分割线 #####################
 */

function httpGet(url, params, callback) {
  getApp().httputil.httpGet(url, params, function (res) {
    if (res != null && res.status != null && res.status == 200) {
      callback.success(res);
    } else {
      callback.fail(res);
    }
  });
}



function httpPost(url, params, callback) {
  getApp().httputil.httpPost(url, params, function (res) {
    if (res != null && res.status != null && res.status == 200) {
      callback.success(res);
    } else {
      callback.fail(res);
    }
  });
}

module.exports = {
  mobileLogin,
  getSingCode,
  queryPageMyDevice,
  getMyDeviceById,
  getDeviceOperationLogList,
  getMyDeviceInfoById,
  storeAddDeviceByWaitAssign,
  getAccountTypeByAuthMobile,
  queryMyMdmMerchantStoreList,
  closeActivationLock,
  enabledActivationLock,
  deviceEdit,
  deviceSetLose,
  deviceUpLock,
  deviceQueryPage,
  deviceUnLock,
  eraseDevice,
  setClearPasscode,
  queryMdmMerchantStoreList,
  queryEnterpriseMerchantUserByAssignList,
  deviceAssignStore,
  deviceAssignUid,
  payBalance,
  deviceSync,
  personalView,
  renewRegulation,
  getEscrowKey,
  rentIdentifierQueryAll,
  queryAppListById,
  deviceSetRent,
  deviceLocationRecord,
  getDeviceConfig,
  sendDefaultRestrict,
  deviceLocationSync,
  disownDevice,
  queryAllFunctionRestrict,
  setFunctionRestrict,
  getMerchantMdmPrice,
  passwordLogin,
  getMerchantUser,
  getMerchantInfo
}